<?php
class m_siswa extends MY_Model {
    public $table = "m_siswa";
    public $id = "nisn";

	public function get_jumlah_menurut_status_sekolah($jenis_id){
		$q = $this->db->query("Select count(ms.nisn) as jumlah, msk.sekolah_status_id,msk.kecamatan_id, ms.jenis_kelamin_id 
								from m_siswa ms
								left join m_sekolah msk on msk.id=ms.sekolah_id
								where msk.sekolah_jenis_id =$jenis_id
								group by msk.kecamatan_id, msk.sekolah_status_id, ms.jenis_kelamin_id ");
        $data = $q->result_array();
		$ret = array();
		foreach($data as $detail){
			$ret[$detail['kecamatan_id']][$detail['sekolah_status_id']][$detail['jenis_kelamin_id']] = $detail['jumlah'];
		}
		return $ret;
	}
}